﻿using UnityEngine;
using System.Collections.Generic;
using ProtoBuf.Message;
namespace UI
{
    //public class Prefix
    //{
    //    public const string actor = "";
    //    public const string tower = "tower_";
    //    public const string camp = "camp_";
    //    public const string monster = "";
    //    public const string gate = "gate_";
    //    public const string revivePoint = "revive_";
    //    public const string chariot = "chariot_";
    //    public const string chariotFactory = "chariot_factory_";
    //    public const string guard = "guard_";
    //    public const string resource = "resource_";
    //}
    
    public class UnionFightData
    {
        public string fightId = "";
        public UnionFightState state = UnionFightState.Ready;
        public long leftTime = 0;//每个状态剩余计时
        public long totalTime = 0;//每个状态总时间
        public int serverId = -1;
        public int unionResNum;     //公会总资源
        public int contributionNum; //战争贡献
        public int battleScore;     //战争积分
        public int selfResNum;      //个人资源
        public int camp = 2;
        public List<InstUFUnion> unions;

        /// <summary>
        /// 是否挂机
        /// </summary>

        private static bool isOnHook = false;
        public static bool IsOnHook
        {
            get
            {
                return isOnHook;
            }
            set
            {
                if(isOnHook != value && value )
                {
                    var str = TableTextBlo.GetText("union_fight_on_hook_on");
                    BoxManager.CreatePopupTextBox(str);
                }
                else if(isOnHook !=value  && !value)
                {
                    var str = TableTextBlo.GetText("union_fight_on_hook_off");
                    BoxManager.CreatePopupTextBox(str);
                }
                
                isOnHook = value;
            }
        }


        public void SetFightData(SCUnionFightTransfer msg)
        {
            fightId = msg.unionFightId;
            state = (UnionFightState)msg.state;
            leftTime = msg.leftTime;
            totalTime = msg.totalTime;
            this.camp = msg.player.camp;
            this.unions = msg.unionInfos;
        }

        public void SetFightData(SCUnionFightUpdateState msg)
        {
            fightId = msg.unionFightId;
            state = (UnionFightState)msg.state;
            leftTime = msg.leftTime;
            totalTime = msg.totalTime;
        }    

        public void GetDictData(long uuid)
        {

        }
    }
}
